package com.example.web.controller;

import static com.outstanding.framework.container.springmvc.WebLogUtils.debug;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.example.web.api.QueryData;
import com.example.web.bo.DemoBO;
import com.example.web.service.TransactionService;
import com.outstanding.framework.core.PendingException;
import com.outstanding.framework.core.ResponseDTO;

@Controller
@RequestMapping("/t")
public class TransactionController {
	
	
	@Autowired
	private TransactionService service;
	
	
	
	
	
	/**
	 * Title: t<br/>
	 * Description: get post请求都会响应<br/>
	 * 
	 * @author ousei
	 * @date 2014年12月15日下午9:05:03
	 *
	 * @return ${返回信息描述}
	 * @throws PendingException
	 * @throws Exception
	 */
	@RequestMapping(value = "/t.do")
	public @ResponseBody ResponseDTO t() throws PendingException {
		debug("调用t");
		DemoBO bo = new DemoBO();
		bo.setName("test");
		this.service.commit(bo);

		return ResponseDTO.creatDTO();
	}
	
	
	/**
	 * Title: r<br/>
	 * Description: get post请求都会响应，会回滚，而且会抛出异常<br/>
	 * 
	 * @author ousei
	 * @date 2014年12月15日下午9:05:03
	 *
	 * @return ${返回信息描述}
	 * @throws PendingException
	 * @throws Exception
	 */
	@RequestMapping(value = "/r.do")
	public @ResponseBody ResponseDTO r() throws PendingException {
		debug("调用t");
		DemoBO bo = new DemoBO();
		bo.setName("sss");
		this.service.submitrolleback(bo);

		return ResponseDTO.creatDTO();
	}
	
	
	
	/**
	 * Title: r<br/>
	 * Description: get post请求都会响应，事务传播，两个都提交<br/>
	 * 
	 * @author ousei
	 * @date 2014年12月15日下午9:05:03
	 *
	 * @return ${返回信息描述}
	 * @throws PendingException
	 * @throws Exception
	 */
	@RequestMapping(value = "/tt.do")
	public @ResponseBody ResponseDTO tt() throws PendingException {
		debug("调用t");
		DemoBO bo = new DemoBO();
		bo.setName("ttt");
		this.service.callService(bo);

		return ResponseDTO.creatDTO();
	}
	
	/**
	 * Title: r<br/>
	 * Description: get post请求都会响应，会回滚，而且会抛出异常<br/>
	 * 
	 * @author ousei
	 * @date 2014年12月15日下午9:05:03
	 *
	 * @return ${返回信息描述}
	 * @throws PendingException
	 * @throws Exception
	 */
	@RequestMapping(value = "/rr1.do")
	public @ResponseBody ResponseDTO rr1() throws PendingException {
		debug("调用t");
		DemoBO bo = new DemoBO();
		bo.setName("rr1");
		this.service.callService1(bo);

		return ResponseDTO.creatDTO();
	}
	
	
	/**
	 * Title: r<br/>
	 * Description: get post请求都会响应，会回滚，而且会抛出异常<br/>
	 * 
	 * @author ousei
	 * @date 2014年12月15日下午9:05:03
	 *
	 * @return ${返回信息描述}
	 * @throws PendingException
	 * @throws Exception
	 */
	@RequestMapping(value = "/rr2.do")
	public @ResponseBody ResponseDTO rr2() throws PendingException {
		debug("调用t");
		DemoBO bo = new DemoBO();
		bo.setName("rr2");
		this.service.callService2(bo);

		return ResponseDTO.creatDTO();
	}
	
	
	
	/**
	 * Title: r<br/>
	 * Description: get post请求都会响应，会回滚，而且会抛出异常<br/>
	 * 
	 * @author ousei
	 * @date 2014年12月15日下午9:05:03
	 *
	 * @return ${返回信息描述}
	 * @throws PendingException
	 * @throws Exception
	 */
	@RequestMapping(value = "/rr3.do")
	public @ResponseBody ResponseDTO rr3() throws PendingException {
		debug("调用t");
		DemoBO bo = new DemoBO();
		bo.setName("rr3");
		this.service.callService3(bo);

		return ResponseDTO.creatDTO();
	}
	
	
	/**
	 * Title: r<br/>
	 * Description: get post请求都会响应，会回滚，而且会抛出异常<br/>
	 * 
	 * @author ousei
	 * @date 2014年12月15日下午9:05:03
	 *
	 * @return ${返回信息描述}
	 * @throws PendingException
	 * @throws Exception
	 */
	@RequestMapping(value = "/rr4.do")
	public @ResponseBody ResponseDTO rr4() throws PendingException {
		debug("调用t");
		DemoBO bo = new DemoBO();
		bo.setName("rr4");
		this.service.callService4(bo);

		return ResponseDTO.creatDTO();
	}
	
	
	/**
	 * Title: r<br/>
	 * Description: get post请求都会响应，会回滚，而且会抛出异常<br/>
	 * 
	 * @author ousei
	 * @date 2014年12月15日下午9:05:03
	 *
	 * @return ${返回信息描述}
	 * @throws PendingException
	 * @throws Exception
	 */
	@RequestMapping(value = "/rr5.do")
	public @ResponseBody ResponseDTO rr5() throws PendingException {
		debug("调用t");
		DemoBO bo = new DemoBO();
		bo.setName("rr5");
		this.service.callService5(bo);

		return ResponseDTO.creatDTO();
	}
	
	
	@RequestMapping(value = "/rr6.do")
	public @ResponseBody ResponseDTO rr6() throws PendingException {
		debug("调用t");
		DemoBO bo = new DemoBO();
		bo.setName("rr6");
		this.service.callService6(bo);

		return ResponseDTO.creatDTO();
	}
	
	
	@RequestMapping(value = "/rr7.do")
	public @ResponseBody ResponseDTO rr7() throws PendingException {
		debug("调用t");
		DemoBO bo = new DemoBO();
		bo.setName("rr7");
		this.service.callService7(bo);

		return ResponseDTO.creatDTO();
	}
}
